﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;
using CUREBusinessLogicLayer;
using CURE.Handler;
using System.Net;
using System.Net.Sockets;

namespace CURE
{
    /// <summary>
    /// 系统主页
    /// </summary>
    public partial class Index : System.Web.UI.Page
    {
        #region 变量
        private string username; public string Username { get { return username; } set { username = value; } }
        private string groupname; public string Groupname { get { return groupname; } set { groupname = value; } }
        private string id; public string Id { get { return id; } set { id = value; } }
        private string host; public string Host { get { return host; } set { host = value; } }

        #endregion

        AuthorityBll authoritybll = new AuthorityBll();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Request.Cookies["MWS_User"] == null)
            {
                Response.Write("<script language=javascript>top.location.href='Login.aspx';</script>");
                Response.End();
                return;
            }

            string groupid = string.Empty;//当前登录用户groupid
            groupid = HttpContext.Current.Request.Cookies["MWS_User"]["GROUP_ID"];
            groupname = authoritybll.GetGroupNameByID(groupid);
            username = HttpContext.Current.Request.Cookies["MWS_User"]["name"];
            id = HttpContext.Current.Request.Cookies["MWS_User"]["ID"];
            host = Dns.GetHostName();
        }

        /// <summary>
        /// 拼接菜单HTML
        /// </summary>
        /// <returns></returns>
        public string GetUrl()
        {
            string groupid = string.Empty;//当前登录用户
            if (HttpContext.Current.Request.Cookies["MWS_User"] != null)
            {
                groupid = HttpContext.Current.Request.Cookies["MWS_User"]["GROUP_ID"];
            }
            string html = authoritybll.getFatherUrl(groupid);
            return html;
        }
    }
}
